package meiyunting.shiwuzhaoling.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * 失物招领服务客户端
 * 使用FeignClient进行服务调用，结合负载均衡
 */
@FeignClient(
    name = "lost-found-service", 
    fallback = LostFoundServiceClientFallback.class,
    configuration = LostFoundServiceFeignConfig.class
)
public interface LostFoundServiceClient {
    
    /**
     * 获取实例信息
     * @return 实例信息
     */
    @GetMapping("/api/instance/info")
    Map<String, Object> getInstanceInfo();
    
    /**
     * 获取用户的失物信息
     * @param userId 用户ID
     * @return 失物列表
     */
    @GetMapping("/api/items/lost/user/{userId}")
    List<Map<String, Object>> getUserLostItems(@PathVariable("userId") Long userId);
    
    /**
     * 获取用户的招领信息
     * @param userId 用户ID
     * @return 招领列表
     */
    @GetMapping("/api/items/found/user/{userId}")
    List<Map<String, Object>> getUserFoundItems(@PathVariable("userId") Long userId);
    
    /**
     * 提交失物信息
     * @param itemData 失物信息
     * @return 提交结果
     */
    @PostMapping("/api/items/lost")
    Map<String, Object> submitLostItem(@RequestBody Map<String, Object> itemData);
    
    /**
     * 提交招领信息
     * @param itemData 招领信息
     * @return 提交结果
     */
    @PostMapping("/api/items/found")
    Map<String, Object> submitFoundItem(@RequestBody Map<String, Object> itemData);
} 